//$.get('https://restapi.amap.com/v3/ip?key=4f8794682030dea431e12c4256e705f5', function(res) {
//	console.log(res);
//	var t_province = res["province"];
//	document.getElementsByName("province")[0].value = t_province;
//	
//	var t_city = res["city"];
//	console.log(t_city)
//	document.getElementsByName("city")[0].value = t_city;
//})

$("#submit").click(function() {
	//省份
	var t_province = $('#province option:selected').val();
	//市
	var t_city = $('#city option:selected').val();
	//区
	var t_district = $('#area option:selected').val();
	var unameVal = $("#uname").val() //用户姓名
	//电话
	var t_phone = $("#uphone").val();
	//详细地址
	var t_address = $('#address').val();


	if(unameVal == "") {
		alert("请输入姓名");
		return;
	}
	var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
	if(!myreg.test(t_phone)) {
		alert("请输入正确的手机号码");
		return;
	}
	if(t_address == "") {
		alert("请输入详细地址");
		return;
	} else {
		setAddress(t_skey, t_phone, t_province, t_city, t_district, t_address, function(_res) {
			$(".success").show()
		})
	}
})

$(".certain").click(function() {
	$(".success").hide()
})

$("body,html").css("height", $("body").height())
$("input").focusout(function() {
	$("body,html").animate({
		scrollTop: 0
	})
})